/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package phoneThreads;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Danilo
 */
public class PhoneThread extends Thread {

    private Socket socket;
    private HashMap<String,Socket> clients;
    public PhoneThread() {
        clients = new HashMap<String, Socket>();
        start();
    }

    @Override
    public void run() {
        try {
            ServerSocket ss = new ServerSocket(1155);
            while(!this.isInterrupted()){
            socket = ss.accept();
            // nova nit za telefon
            new ClientThread(socket, this);
            }
        } catch (Exception ex) {
            Logger.getLogger(PhoneThread.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /**
     * @return the clients
     */
    public HashMap<String,Socket> getClients() {
        return clients;
    }

}
